home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / misc / emu / arosdev.lha / AROS / rom / utility / allocatetagitems.c < prev    next >
C/C++ Source or Header  |  1997-01-27  |  2KB  |  102 lines

  1. /*
  2.     $Id: allocatetagitems.c,v 1.8 1997/01/27 13:17:13 digulla Exp $
  3.     $Log: allocatetagitems.c,v $
  4.     Revision 1.8  1997/01/27 13:17:13  digulla
  5.     Added #include <proto/exec.h>
  6.  
  7.     Revision 1.7  1997/01/27 00:32:29  ldp
  8.     Polish
  9.  
  10.     Revision 1.6  1996/12/10 14:00:12  aros
  11.     Moved #include into first column to allow makedepend to see it.
  12.  
  13.     Revision 1.5  1996/10/24 22:51:46  aros
  14.     Use proper Amiga datatypes (eg: ULONG not unsigned long)
  15.  
  16.     Revision 1.4  1996/10/24 15:51:34  aros
  17.     Use the official AROS macros over the __AROS versions.
  18.  
  19.     Revision 1.3  1996/09/13 17:36:37  digulla
  20.     Use IPTR
  21.  
  22.     Revision 1.2  1996/09/12 14:52:47  digulla
  23.     Better way to separate public and private parts of the library base
  24.  
  25.     Revision 1.1  1996/08/31 12:58:11  aros
  26.     Merged in/modified for FreeBSD.
  27.  
  28.     Desc: AllocateTagItems()
  29.     Lang: english
  30. */
  31. #include <proto/exec.h>
  32. #include "utility_intern.h"
  33.  
  34. /*****************************************************************************
  35.  
  36.     NAME */
  37. #include <utility/tagitem.h>
  38. #include <proto/utility.h>
  39.  
  40.     AROS_LH1(struct TagItem *, AllocateTagItems,
  41.  
  42. /*  SYNOPSIS */
  43.     AROS_LHA(ULONG, numTags, D0),
  44.  
  45. /*  LOCATION */
  46.     struct UtilityBase *, UtilityBase, 11, Utility)
  47.  
  48. /*  FUNCTION
  49.     Allocate a number of TagItems in an array for whatever you like.
  50.     The memory allocated will be cleared.
  51.  
  52.     INPUTS
  53.     numTags     - The number of TagItems to allocate.
  54.  
  55.     RESULT
  56.     A pointer to an array of struct TagItem containing numTags tags.
  57.  
  58.     NOTES
  59.     The number you supply must include the terminating tag (ie TAG_DONE)
  60.     There is no provision for extra TagItems at the end of the list.
  61.  
  62.     If the number of tags to allocate is zero, then none will be.
  63.  
  64.     EXAMPLE
  65.     struct TagItem *tagList;
  66.  
  67.     tagList =  AllocateTagItems( 4 );
  68.  
  69.     tagList[0].ti_Tag  = NA_Name;
  70.     tagList[0].ti_Data = (IPTR)"A list of tags";
  71.     tagList[3].ti_Tag  = TAG_DONE;
  72.  
  73.     \* Do what you want with your TagList here ... *\
  74.  
  75.     FreeTagItems( tagList );
  76.  
  77.     BUGS
  78.  
  79.     SEE ALSO
  80.     FreeTagsItems()
  81.  
  82.     INTERNALS
  83.  
  84.     HISTORY
  85.     29-10-95    digulla automatically created from
  86.                 utility_lib.fd and clib/utility_protos.h
  87.     11-08-96    iaint   Moved code into the AROS source.
  88.  
  89. *****************************************************************************/
  90. {
  91.     AROS_LIBFUNC_INIT
  92.     struct TagItem *tags = NULL;
  93.  
  94.     if( numTags )
  95.     tags = AllocVec( numTags << 3, MEMF_CLEAR | MEMF_PUBLIC );
  96.  
  97.     return tags;
  98.  
  99.     AROS_LIBFUNC_EXIT
  100.  
  101. } /* AllocateTagItems */
  102.